﻿using System;

namespace Safebrowsing
{
    /// <summary>
    /// Contains constants used for parsing
    /// </summary>
    internal class Constants
    {
        public const string DATA_REQUEST_URL =
            "http://safebrowsing.clients.google.com/safebrowsing/downloads?client=api&apikey={0}&appver={1}&pver={2}";

        public const string GET_HASH_REQUEST_URL =
            "http://safebrowsing.clients.google.com/safebrowsing/gethash?client=api&apikey={0}&appver={1}&pver={2}";

        public const string API_VERSION = "2.2";
        public const string SCHEMA_VERSION = "3.0";
        public const string PROTOCOL = "http";
        public const char LF = '\n';
        public const string MARK_SIZE = "s;";
        public const string MARK_MIN_DELAY = "n:";
        public const string MARK_LIST_NAME = "i:";
        public const string MARK_REDIRECT_URL = "u:";
        public const string MARK_ADDDEL = "ad:";
        public const string MARK_SUBDEL = "sd:";
        public const string MARK_ADDCHUNK = "a:";
        public const string MARK_SUBCHUNK = "s:";
        public const string MARK_RESET = "r:pleasereset";

        public const int DB_WRITE_TIMEOUT = 60000;
        public const int DB_READ_TIMEOUT = 25;
        public const int DB_MAINTENANCE_TIMER_PERIOD = 60000*30; // 1 hour

        public static readonly TimeSpan MAX_AGE_OF_DATA = new TimeSpan(0, 45, 0); // 45 minutes
        public static readonly TimeSpan IDLE_TIME_BEFORE_VACUUM = new TimeSpan(0, 15, 0); // 15 minutes
        public static readonly TimeSpan IDLE_TIME_BEFORE_REINDEX = new TimeSpan(0, 15, 0); // 15 minutes
        public static readonly TimeSpan VACUUM_PERIOD = new TimeSpan(7, 0, 0, 0); // 7 days
        public static readonly TimeSpan REINDEX_PERIOD = new TimeSpan(7, 0, 0, 0); // 7 days
    }
}